// 关于用于转账、
const orderModel = require('../../models/step/order')
class OrderController{

static async getOrder(ctx){
  let { orderId } = ctx.request.query
      const params = {
        _id: orderId
      }
      const order = await orderModel.findOne(params)
      ctx.body= {
        err:0,
        msg:'success',
        data:{order}
      }
}

static async addOrder(ctx){
  let { paymentId,paymentMethod,account,name,money }=ctx.request.body
  const params={
    paymentId,paymentMethod,account,name,money
  }
  const re=await orderModel.insertMany([params])
  const orderId = await orderModel.findOne(params)
  ctx.body = { 
    err: 0, 
    msg: '添加成功' ,
    data:{orderId:orderId._id}
  }
}
static async ChangeOrder(ctx){
  let { orderId } = ctx.request.query
    let info = await orderModel.updateOne({_id:orderId}, {status:2})
      ctx.body= {
        err:0,
        msg:'success',
        data:{info}
      }

}

}

module.exports = OrderController